package com.turbo.cloud.rule.cmp.sex;

import com.turbo.cloud.core.exception.BusinessException;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeIfComponent;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

/**
 * @author zhangluning
 * Liteflow 编排规则 性别男
 */
@Slf4j
@LiteflowComponent("SexManRule")
public class SexManRuleCmp extends NodeIfComponent {

    /**
     * 男
     */
    final static String MAN = "男";

    @Override
    public boolean processIf() {
        try {
            String sex = (String) ((Map) getRequestData()).get("sex");
            if (MAN.equals(sex)) {
                return true;
            }
            return false;
        } catch (Exception e) {
            log.error("Liteflow 编排规则性别男异常", e);
            throw new BusinessException("编排规则性别男异常(" + e.getMessage() + ")");
        }
    }
}
